﻿// -
// <copyright file="SpeechRecognitionCompletedEventArgs.cs" company="Microsoft Corporation">
//    Copyright (c) Microsoft Corporation.  All rights reserved.
// </copyright>
// -

namespace Hawaii.Services.Speech.Recognition
{
    using System;
    using System.Net;
    using System.Collections.Generic;

    /// <summary>
    /// EventArgs class for a SpeechRecognitionCompleted event.
    /// </summary>
    public class SpeechRecognitionCompletedEventArgs : EventArgs
    {
        /// <summary>
        /// Specifies an Exception for a service call invocation.
        /// </summary>
        public Exception ErrorException { get; set; }

        /// <summary>
        /// Specifies the list of recognized texts.
        /// </summary>
        public List<string> RecognizedTexts { get; set; }

        /// <summary>
        /// Helper property wraps the 'ErrorException' property.
        /// </summary>
        public bool IsErrored 
        { 
            get 
            { 
                return this.ErrorException != null; 
            } 
        }

        /// <summary>
        /// Default constructor
        /// </summary>
        public SpeechRecognitionCompletedEventArgs()
            : base()
        {
            this.ErrorException = null;
            this.RecognizedTexts = null;
        }

        /// <summary>
        /// Overloaded constructor with the recognized texts list.
        /// </summary>
        /// <param name="recognizedText"></param>
        public SpeechRecognitionCompletedEventArgs(List<string> recognizedTexts)
            : base()
        {
            this.ErrorException = null;
            this.RecognizedTexts = recognizedTexts;
        }

        /// <summary>
        /// Overloaded constructor with errorException.
        /// </summary>
        /// <param name="errorException"></param>
        public SpeechRecognitionCompletedEventArgs(Exception errorException)
            : base()
        {
            this.ErrorException = errorException;
            this.RecognizedTexts = null;
        }
    }
}
